package demo.day14

// 懒汉式单例的实现 Kotlin版本 安全 双重校验
class SingletonDemoSafe2Kt private constructor() {
    companion object {
        val instance: SingletonDemoSafe2Kt by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
            SingletonDemoSafe2Kt()
        }
    }

    fun show() {
        println("show函数被调用了")
    }
}

fun main() {
    SingletonDemoSafe2Kt.instance.show()
}